﻿#region Creditos

/* Autor: Edilberto Sánchez Forero	*/
/* Email: esanchezfo@gmail.com		*/
/* Licencia: Propietario			*/
/* País: Colombia, Bogotá			*/

#endregion

#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESF.General.Entity;
using System.Data;
using ESF.General;

#endregion


namespace ESF.SSO.Core.DataAccess.BasicReferences
{
	public static class AdoBasicReferenceType
	{
		#region Read
		
		public static List<BasicReferenceType> List ()
		{
			return AdoESFSSO.R.GetList <BasicReferenceType> (AdoESFSSO.R.CreateSPCommand ("[esf_sso].P_ListBasicReferenceTypes"), ConvertTo);
		}
		
		
		private static BasicReferenceType ConvertTo (IDataReader pReader, string pPrefix = "", string pListLoading = "")
		{
			return new BasicReferenceType ()
			{
				ID = DataHelper.GetInt (pReader, "ID"),
				Name = DataHelper.GetString (pReader, "Name")
			};
		}
		
		
		public static BasicReferenceType Get (BasicReferenceType pSample)
		{
			IDbCommand cmd;
			
			
			cmd = AdoESFSSO.R.CreateSPCommand ("esf_sso.P_GetBasicReferenceType");
			
			AdoESFSSO.R.AddIDParameter (cmd, "pID", pSample.ID);
			
			return AdoESFSSO.R.Get <BasicReferenceType> (cmd, ConvertTo);
		}
		
		#endregion
	}
}
